<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    
    <ui:composition template="/template.xhtml">
        
        <ui:define name="top">
            <ui:include src="/header.xhtml"/>
        </ui:define>
        
        <ui:define name="content">
            <h:form styleClass="jsfcrud_list_form">
                <h:commandLink value="Agregar Rol" action="#{rolController.prepareCreate}"/>
                    <h:panelGroup rendered="#{rolController.items.rowCount > 0}">
                        <h:dataTable value="#{rolController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rules="all" style="border:solid 1px">
                            <h:column>
                                <h:inputHidden value="#{item.id}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Nombre"/>
                                </f:facet>
                                <h:outputText value="#{item.nombre}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Acciones"/>
                                </f:facet>
                                <h:commandLink action="#{rolController.prepareView}" value="Detalles"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{rolController.prepareEdit}" value="Editar"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{rolController.destroy}" value="Eliminar"/>
                            </h:column>                        
                    </h:dataTable>
                    <br/>
                    <h:outputText value="#{rolController.pagination.pageFirstItem + 1}...#{rolController.pagination.pageLastItem + 1}/#{rolController.pagination.itemsCount}"/>
                    <h:commandLink action="#{rolController.previous()}" value="Anterior #{rolController.pagination.pageSize}" rendered="#{rolController.pagination.hasPreviousPage}"/>
                    <h:commandLink action="#{rolController.next()}" value="Siguiente #{rolController.pagination.pageSize}" rendered="#{rolController.pagination.hasNextPage}"/>  
                </h:panelGroup>
                <br />
                <br />
                <h:commandLink value="Ir Inicio" action="/index" immediate="true" />
            </h:form>  
            <div id="footer">
            <ui:include src="/footer.xhtml"/>  
        </div>   
         </ui:define>  
    </ui:composition>        
</html>
